
<?php
	if(isset($_SESSION['user']))
	{
		echo '<script type = "text/javascript">';
		echo 'location = "index.php";';
		echo '</script>';
	}else{
		include("lib/DataProvider.php");
	?>
<link href="withcmb" rel="stylesheet" type="text/css" />

	<form action="inc/xlDangKy.php" method="post" name="frmDangKy" enctype="multipart/form-data" onSubmit="return KiemTraDangKy();">
	<table class="frmDangKy">
		<tr>
			<td class="DangKy">
				<table>					
					<tr>
						<td colspan="3" id="loi">Hãy cho biết những thông tin sau, <span class="redstar">*</span> là bắt buộc.</td>
					</tr>				
					<tr>
						<td colspan="3" class="textcenter">Thông tin đăng Ký</td>
					</tr>
					
					<tr>
						<td class="textright">Loại khách hàng:</td>
						<td>
						<input type="radio" name="rdbLoai" checked="checked" value="rdbBuyer" />Người mua
						<input type="radio" name="rdbLoai" value="rdbSeller" />Người bán
						</td>
						<td width="200px"></td>
					</tr>
					<tr>
						<td class="textright">Tên đăng nhập:</td>
						<td><input name="txtTenDangNhap" type="text" autocomplete="off" id="txtTenDangNhap" size="30" maxlength="30"  />
						
						</td>
						<td>
						<span id="errTenDangNhap" class="redstar" >*</span></td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2"><div class="thongbao" id="thongbao"></div></td>
						
					</tr>
					<tr>
						<td class="textright">Mật khẩu:</td>
						<td><input name="txtMatKhau" type="password" autocomplete="off" id="txtMatKhau"  size="30" maxlength="30" /></td>
						<td><span id="errMatKhau" class="redstar">*</span></td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2"><div  class"error" id="errMatKhau2"></div></td>		
					</tr>
					<tr>
						<td class="textright">Nhập lại mật khẩu:</td>
						<td><input name="txtNhapLaiMatKhau" type="password" autocomplete="off" id="txtNhapLaiMatKhau" size="30" maxlength="30" /></td>
						<td><span id="errNhapLaiMatKhau" class="redstar">*</span></td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2"><div id="errNhapLaiMatKhau2" class"error"></div></td>
					</tr>
					<tr>
						<td class="textright">Email:</td>
						<td><input name="txtEmail" type="text" id="txtEmail" autocomplete="off" size="30" maxlength="100" /></td>
						<td><span id="errEmail" class="redstar">*</span></td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2"><div class="thongbao2" id="thongbao2"></div></td>
						
					</tr>
					<tr>
						<td class="textright">Nhập lại Email:</td>
						<td><input name="txtNhapLaiEmail" type="text" id="txtNhapLaiEmail" size="30" maxlength="100" /></td>
						<td><span id="errNhapLaiEmail" class="redstar">*</span></td>
					</tr>	
					<tr>
						<td></td>
						<td colspan="2"><div class="errNhapLaiEmail2" id="errNhapLaiEmail2"></div></td>
					</tr>		
					<tr>
						<td colspan="3" class="textcenter">Thông tin khách hàng </td>
					</tr>
					<tr>
						<td class="textright">Tên đại diện:</td>
						<td><input name="txtHoTen" type="text" id="txtHoTen" size="30" maxlength="50" /></td>
						<td><span id="errHoTen" class="redstar">*</span></td>
					</tr>
					<tr>
						<td class="textright">Ảnh đại điện:</td>
						<td><input name="Anh" type="file" id="Anh" size="20" maxlength="200" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td class="textright">Ngày sinh:</td>
						<td>
						</select>
						<select name="cmbNgay">
							<option value="" class="withcmb">[Ngày]</option>
							<?php
								for($i=1;$i<=31;$i++)
								{
							?>	
								<option value="<?php echo $i;?>"><?php echo $i;?></option>
							<?php } ?>
						</select>
						</select>
						<select name="cmbThang">
							<option value="" class="withcmb">[Tháng]</option>
							<?php
								for($i=1;$i<=12;$i++)
								{
							?>	
								<option value="<?php echo $i;?>"><?php echo $i;?></option>
							<?php } ?>
						</select>
						<?php
							$namhientai=date("Y");
						?>
						<select name="cmbNam">
						<option value="" class="withcmb" >[Năm]</option>
							<?php
								for($i=$namhientai;$i>1900;$i--)
								{
							?>	<option value="<?php echo $i;?>"><?php echo $i;?></option>
						<?php } ?>
						</select>
						</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td class="textright">Giới tính:</td>
						<td>
						<input type="radio" name="rdbGioiTinh" checked="checked" value="rdbNam" />Nam
						<input type="radio" name="rdbGioiTinh" value="rdbNu" />Nữ
						</td>
						<td></td>
					</tr>
					<tr>
						<td class="textright">Điện thoại:</td>
						<td><input name="txtDienThoai" type="text" id="txtDienThoai" size="30" maxlength="14" /></td>
						<td></td>
					</tr>
					<tr>
						<td class="textright">CMND:</td>
						<td><input name="txtCMND" type="text" id="txtCMND" size="30" maxlength="12" /></td>
						<td></td>
					</tr>
					<tr>
						<td class="textright">Tỉnh/Thành phố:</td>
						<td>
						<select name="cmbTinh" id="cmbTinh" onchange="loadHuyen(this.value)" size="1">
							<option value="">Chọn Tỉnh</option>
						<?php 
							$ds = DataProvider::ExecuteQuery("select * from tinh");
							while ($row = mysql_fetch_array($ds,MYSQLI_STORE_RESULT))
							{?>
								<option value="<?php echo $row['MATINH'];?>"><?php echo $row['TENTINH'];?> </option>
							<?php }
						?>
						</select>
						</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td class="textright">Huyện/Quận:</td>
						<td><div id="Huyen"><b>Vui lòng chọn tỉnh.</b></div></td>
						<td>&nbsp;</td>
					</tr>				
					<tr>
						<td class="textright">Xã/Phường:</td>
						<td><input name="txtXa" type="text" id="txtXa" size="30" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td class="textright">Ấp/Khu Phố:</td>
						<td><input name="txtAp" type="text" id="txtAp" size="30" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td class="textright">Tên đường:</td>
						<td><input name="txtTenDuong" type="text" id="txtTenDuong" size="30" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td class="textright">Số nhà:</td>
						<td><input name="txtSoNha" type="text" id="txtSoNha" size="30" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2" >
							<input type="submit" name="btnDangKy" id="btnDangKy" value="Đăng Ký" />
							<input type="reset" name="btnLamMoi" id="btnLamMoi" value="Làm Mới"/>
						</td>
						<td></td>
					</tr>
				</table>
			</td>
			<td class="gioithieu">
			</td>
		</tr>
	</table>
	</form>
	<?php
	}
?>